package com.codingman.mybatisdemo3;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
//@Mapper
public interface EmployeeMapper {
	
	@Select("select * from employee where id = #{id}")
	Employee getEmployeeById(Integer id);

	@SelectProvider(type = EmployeeSqlBuilder.class, method = "buildGetEmployeeById")
	Employee getEmployeeById2(Integer id);
	
	@Insert("INSERT INTO employee(id, name, salary) VALUES (#{id}, #{name}, #{salary})")
	void insertEmployee(Employee account);

	@Update("UPDATE employee SET name = #{name}, salary = #{salary} WHERE id = #{id}")
	void updateEmployee(Employee account);

	@Delete("delete from employee where id = #{id}")
	void deleteEmployee(Integer id);

	@Select("select * from employee")
	List<Employee> findAll();
}
